package com.example.test.责任链1;


public abstract class AddMethodService {

    AddMethodService addMethodService;

    abstract int addNum(int num);

    public void setNext(AddMethodService tail) {
        addMethodService = tail;
    }

    public AddMethodService getNext() {
        return addMethodService;
    }

    public void execute(int i) {
        int num = addNum(i);
        if (this.addMethodService != null) {
            this.addMethodService.execute(num);
        }
    }
}
